<%-- 
    Document   : profile
    Created on : Dec 18, 2012, 9:43:24 AM
    Author     : gcastillo, nbenavidez
--%>

<%@ page import="com.almori.hr.timetracker.*" import="java.io.File" import="java.text.*" %>
 <%    
              TimeTrackerBean bean = new TimeTrackerBean();
              String I = request.getParameter("id");
              int id = Integer.parseInt(I);
              Timecard myCard = new Timecard();
              myCard = bean.getTimecardById(id);
              String strDate = new SimpleDateFormat("MMM-dd-yyyy").format(myCard.getIn());
              Employee me = (Employee)session.getAttribute("Employee");                                                       
 %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title> <%= me.getfName() + " " + me.getlName() %> </title>
        <link rel="Shortcut icon" href="img/logo.png" />
        <link rel="stylesheet" type="text/css" href="css/style_profile.css" />
          <!--[if IE 8]>
           <link rel="stylesheet" type="text/css" href="css/styleIE.css" />
        <![endif]-->
          <script language="javascript" type="text/javascript">
              window.onunload = function(){ 
                  window.opener.location.reload(); 
              }; 
              
          </script>
    </head>
    <body>
        <br />
          <form id="signup" action="action.jsp" method="POST">
           <div class="inputs">
               <h4>Edición de Ficha de Tiempo</h4>
               <input type="hidden" name="action" value="3"/>
               <input type="hidden" name="_timeCardId" value="<%= id %>"/>
               <input type="hidden" name="_strDate" value="<%= strDate %>"/>
               <br />
               <table border='0'>
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;position:static;">Fecha :</td>
                     <td style="text-align: left; overflow: hidden; width: 250px;"> <%= strDate %> </td>
                  </tr>
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;">Hora de Entrada :</td>
                     <td style="text-align: left; overflow: hidden; width: 250px;">
                         <select name="_inHrs">
                            <% for (int i=1; i<=12; i++){ %>
                                    <option value="<%= i %>"
                                        <% if (myCard.getIn_hrs().equals(String.format("%02d", i))) { %>
                                            selected="true" 
                                        <% } %>
                                        >
                                        <%= String.format("%02d", i) %>
                                    </option>
                             <% } %>
                         </select>:
                         <select name="_inMin">
                             <% for (int i=1; i<=60; i++){ %>
                                    <option value="<%= i %>"
                                        <% if (myCard.getIn_min().equals(String.format("%02d", i))) { %>
                                            selected="true" 
                                        <% } %>
                                        >
                                        <%= String.format("%02d", i) %>
                                    </option>
                             <% } %>
                         </select>
                         <select name="_inAMPM">
                             <option value="AM" <% if (myCard.getIn_ampm().equals("AM")) { %> selected="true" <% } %> >AM</option>
                             <option value="PM" <% if (myCard.getIn_ampm().equals("PM")) { %> selected="true" <% } %> >PM</option>
                         </select>
                     
                     </td>
                  </tr>
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;">Hora de Salida :</td>
                     <td style="text-align: left; overflow: hidden; width: 250px;">
                         <select name="_outHrs">
                            <% for (int i=1; i<=12; i++){ %>
                                    <option value="<%= i %>"
                                        <% if (myCard.getOut_hrs().equals(String.format("%02d", i))) { %>
                                            selected="true" 
                                        <% } %>
                                        >
                                        <%= String.format("%02d", i) %>
                                    </option>
                             <% } %>
                         </select>:
                         <select name="_outMin">
                              <% for (int i=1; i<=60; i++){ %>
                                    <option value="<%= i %>"
                                        <% if (myCard.getOut_min().equals(String.format("%02d", i))) { %>
                                            selected="true" 
                                        <% } %>
                                        >
                                        <%= String.format("%02d", i) %>
                                    </option>
                             <% } %>
                         </select>
                         <select name="_outAMPM">
                            <option value="AM" <% if (myCard.getOut_ampm().equals("AM")) { %> selected="true" <% } %> >AM</option>
                            <option value="PM" <% if (myCard.getOut_ampm().equals("PM")) { %> selected="true" <% } %> >PM</option>
                         </select>
                         
                     </td>
                  </tr>
               
                  <tr>
                     <td style="text-align: left; overflow: hidden; width: 150px;">Razón :</td>
                     <td style="text-align: left; overflow: hidden; width: 250px;">
                          <select name="_reason">
                            <option value="Receso Regular" <% if (myCard.getReason().equals("Receso Regular")) { %> selected="true" <% } %> >Receso Regular</option>
                            <option value="Receso Personal" <% if (myCard.getReason().equals("Receso Personal")) { %> selected="true" <% } %> >Receso Personal</option>
                            <option value="Almuerzo" <% if (myCard.getReason().equals("Almuerzo")) { %> selected="true" <% } %> >Almuerzo</option>
                            <option value="Salida" <% if (myCard.getReason().equals("Salida")) { %> selected="true" <% } %> >Salida</option>
                         </select>
                     </td>
                  </tr>
              
               </table>
               <br />
               <input type="submit" value="Guardar" onclick="window.close()"></input>
          </div>
          </form>
         
    </body>
</html>
